package bancosys.tec.security.impl.permission.parser.impl;

import bancosys.tec.security.authorization.AuthorizablePermission;
import bancosys.tec.security.authorization.Permission;
import bancosys.tec.security.impl.permission.parser.PermissionParser;
import bancosys.tec.security.web.AuthorizationPermissionMapping;

/**
 * @author takeshi
 */
public class AuthorizablePermissionParser implements PermissionParser {

    /**
     * {@inheritDoc}
     */
    public Permission parse(String permission) {
        if (AuthorizationPermissionMapping.getInstance().getPermissions().contains(permission.toUpperCase().trim())) {
            return new AuthorizablePermission(permission);
        }
        return null;
    }

}
